import featureAbility from '@ohos.ability.featureAbility';
import data_storage from '@ohos.data.storage';

export default {
    onCreate() {
        this.setPath();
    },
    onDestroy() {

    },
    setPath() {
        featureAbility.getContext().getFilesDir().then((path) => {
            this.globalData.path = path + '/zz';
        })
    },
    setUser() {
        let user = data_storage.getStorageSync(this.globalData.path).getSync('user', 'null');
        this.globalData.user = user == 'null' ? null : JSON.parse(user);
    },
    globalData: {
        imageUrl: 'http://117.78.16.25:8881/images/',
        path: '',
        token: '',
        user: {}
    }
}